package com.lhys.mapper;

import com.lhys.pojo.AssetDeviceUse;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 设备用途 Mapper 接口
 * </p>
 *
 * @author 小七
 * @since 2021-05-06
 */
public interface AssetDeviceUseMapper {
    //查询设备用途列表
    @Select("select * from asset_device_use")
    List<AssetDeviceUse> getAssetDeviceUseList();

    //根据名称或说明查询
    List<AssetDeviceUse> getAssetDeviceUseByCodeAndTitleOrRemarkList(AssetDeviceUse assetDeviceUse);

    //根据id查询
    @Select("select * from asset_device_use where id = #{id}")
    AssetDeviceUse getAssetDeviceUseById(Integer id);

    //根据用户id查询
    @Select("select * from asset_device_use where assetUserId = #{assetUserId}")
    AssetDeviceUse getAssetDeviceUseByAssetUserId(Integer assetUserId);

    //根据编码查询
    @Select("select * from asset_device_use where code = #{code}")
    AssetDeviceUse getAssetDeviceUseByCode(String code);

    //新增设备用途
    @Insert("insert into asset_device_use(asset_user_id, title, code, status,remark, create_time) VALUES (#{assetUserId}, #{title}, #{code}, #{status}, #{remark}, #{createTime})")
    Integer addAssetDeviceUse(AssetDeviceUse AssetDeviceUse);

    //删除设备用途
    @Delete("delete from asset_device_use where id = #{id}")
    Integer delAssetDeviceUse(Integer id);

    //修改设备用途
    Integer updateAssetDeviceUse(AssetDeviceUse assetDeviceUse);

}
